package com.nikkerball.security.impl;

import com.nikkerball.security.Role;
import com.nikkerball.security.SecurityController;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by IntelliJ IDEA.
 * User: Marius
 * Date: 16-Jan-2010
 * Time: 13:48:36
 */
public class DummySecurityController implements SecurityController {

    // ----- class fields -----

    private static final String ADMIN = "admin";

    private static final String USER = "user";

    // ----- SecurityController -----

    public boolean authenticateUser(String userName, String password) {
        return userName.equals(USER) && password.equals(USER) || userName.equals(ADMIN) && password.equals(ADMIN);
    }

    public List<Role> getRolesForUser(String userName) {
        List<Role> roles = new ArrayList<Role>();
        if (USER.equals(userName)) {
            roles.add(Role.USER);
        } else if (ADMIN.equals(userName)) {
            roles.add(Role.ADMIN);
        }
        return roles;
    }
}
